package com.seuic.hnjiningposapp.hnapps.ui.view.dialog;

import android.content.Context;
import android.view.View;
import android.widget.Button;

import androidx.annotation.NonNull;

import com.lxj.xpopup.core.BasePopupView;
import com.seuic.hnjiningposapp.R;
import com.seuic.hnjiningposapp.hnapps.ui.activity.ConstantrotationActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

/**
 * 选择活转定类型
 */
public class SelHtoDSaveTypePp extends BasePopupView {

    @BindView(R.id.select_dealwholedeposit_btn)
    Button selectDealwholedepositBtn;
    @BindView(R.id.select_dealones_btn)
    Button selectDealonesBtn;
    Unbinder bind;
    onSelSaveType mOnSelSaveType;

    public SelHtoDSaveTypePp(@NonNull Context context, onSelSaveType onSelSaveType) {
        super(context);
        this.mOnSelSaveType = onSelSaveType;

    }

    @Override
    protected int getPopupLayoutId() {
        return R.layout.select_dealtype_layout;
    }

    @Override
    protected void onCreate() {
        super.onCreate();
        bind = ButterKnife.bind(this);

    }

    @OnClick({R.id.select_dealwholedeposit_btn, R.id.select_dealones_btn})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.select_dealwholedeposit_btn:
                //整存整取
                mOnSelSaveType.SelType(ConstantrotationActivity.HTOD_SElALLTYPE);
                break;
            case R.id.select_dealones_btn:
                //智能存
                mOnSelSaveType.SelType(ConstantrotationActivity.HTOD_CAPACITYTYPE);
                break;
        }
    }

    public interface onSelSaveType {
        //整存整取
        void SelType(String type);
    }

    @Override
    protected void onDismiss() {
        super.onDismiss();
        //注解解绑
        if (bind != null && bind != Unbinder.EMPTY) {
            bind.unbind();
        }
        this.bind = null;
    }
}
